home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Mania 4
/
MacMania 4.toast
/
/
Demo's
/
Igor Demo Pro
/
3 PutContentsIn Igor Pro Folder
/
Technical Notes
/
Igor Tech Notes
/
TN021 Ternary Graphs
/
Ternary Folder
/
procedure
< prev
next >
Wrap
Text File
|
1990-10-04
|
4KB
|
143 lines
|••••••
| The GrafTernData() macro converts normalized data waves provided by you
| the user into the proper format for plotting on a new ternary or to be
| appended to an appropriate target ternary.
|
| The following information is specified through a missing parameter dialog:
| (1) Names of the three waves to be graphed. Only the B and C
| component waves are required for the coordinate transform.
| The wave names supply the axis label names.
| (2) One of the three types of ternaries to be displayed. This is
| optional if appending to a ternary graph.
| (3) Names for the X and Y waves that will contain the transformed
| data for graphing on the ternary.
| (4) Create a new ternary or append to an existing one.
|
| The new X and Y waves that are created will automatically overwrite any waves
| that already have the same name(s).
Macro GrafTernData( Awave, Bwave, Cwave, type, Xwave, Ywave, doNew )
String Awave
Prompt Awave, "Select the A component wave :", popup, WaveList("*",";","")
String Bwave
Prompt Bwave, "Select the B component wave :", popup, WaveList("*",";","")
String Cwave
Prompt Cwave, "Select the C component wave :", popup, WaveList("*",";","")
Variable type
Prompt type, "Ternary graph type :", popup, "Ternary;Ticked Tern;Gridded Tern"
String Xwave = "x_Twave"
Prompt Xwave, "Name for the ternary X-data wave:"
String Ywave = "y_Twave"
Prompt Ywave, "Name for the ternary Y-data wave:"
Variable doNew
Prompt doNew, "What to Do?", popup, "New Ternary;Append"
PauseUpdate; Silent 1
Duplicate /O $Bwave, $Xwave, $Ywave
$Xwave = 0.5 * ($Cwave) + ($Bwave) | Do the coordinate transformation
$Ywave = $Cwave * cos(30*(Pi/180)) | Degrees to radians
if( doNew == 1 ) | Create a new graph
if( type == 1)
Ternary() | Vanilla Ternary
endif
if( type == 2)
TernTicks() | Ternary with tick marks
endif
if( type == 3)
TernGrid() | Ternary with a grid
endif
ReplaceText /N=Abox Awave | Add proper labels to ternary apices…
ReplaceText /N=Bbox Bwave
ReplaceText /N=Cbox Cwave
endif
If( char2num(WinName(0,1)) == char2num("") ) | Is a target graph window open for appending?
Abort "Open graph required to append data!"
endif
String Windo=WinName(0,1)
DoWindow /F $Windo
Append $Ywave vs $Xwave
Modify mode($Ywave)=3
EndMacro
|•••••
| ConvertF2P2F() is a utility macro to convert the data waves defining the
| ternary graphs to a percent basis or back to fractions again to accommodate
| the type of data you are graphing on the ternary.
Macro ConvertF2P2F()
PauseUpdate; Silent 1 | modifying data…
if(Xaxes[1] == 100) | Convert percents to fractions
Xaxes = Xaxes/100; Yaxes = Yaxes/100
Xgrid = Xgrid/100; Ygrid = Ygrid/100
Xticks = Xticks/100; Yticks = Yticks/100
else | Convert fractions to percents
Xaxes = Xaxes*100; Yaxes = Yaxes*100
Xgrid = Xgrid*100; Ygrid = Ygrid*100
Xticks = Xticks*100; Yticks = Yticks*100
endif
EndMacro
Menu "Macros"
"Graf Tern Data /0"
"(-"
"Convert F2P2F /1"
End
Proc NameWind()
Variable Wnum=0
String Wbase="Untitled_", Wname
do
Wname = Wbase + num2istr( Wnum )
Wnum += 1
while( WinType( Wname ) )
DoWindow /C $Wname
endMacro
Window Ternary() : Graph
PauseUpdate; Silent 1 | building window...
Display /W=(36,59,317,305) Yaxes vs Xaxes
Modify margin(top)=36,margin(right)=36,width={Plan,1,bottom,left}
Modify lHair=0.5
Modify rgb=(0,0,0)
Modify noLabel=2
Modify axThick=0
Tag /N=Abox/F=0/S=3/A=MT/X=0/Y=-2/L=0 Yaxes, 0, "Comp. A"
Tag /N=Bbox/F=0/S=3/A=MT/X=0/Y=-2/L=0 Yaxes, 1, "Comp. B"
Tag /N=Cbox/F=0/S=3/A=MB/X=0/Y=0.5/L=0 Yaxes, 2, "Comp. C"
NameWind()
EndMacro
Window TernTicks() : Graph
PauseUpdate; Silent 1 | building window...
Ternary()
Append Yticks vs Xticks
Modify lHair=0.5
Modify rgb(Yticks)=(0,0,65535)
EndMacro
Window TernGrid() : Graph
PauseUpdate; Silent 1 | building window...
Ternary()
Append Ygrid vs Xgrid
Modify lSize(Ygrid)=0.5
Modify lStyle(Ygrid)=1
Modify lHair=0.5
Modify rgb(Ygrid)=(32591,65535,32371)
EndMacro